package week2;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/**
 * @author The Setting sun
 * @create 2021-09-16 16:46
 */
public class work2 {
    public static void main(String[] args) {
        JFrame frame = new JFrame();

        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(1);
            }
        });
        frame.setSize(500, 450);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

class Listener1 implements WindowListener {

    @Override
    public void windowOpened(WindowEvent e) {

    }

    @Override
    public void windowClosing(WindowEvent e) {
        System.exit(1);
    }

    @Override
    public void windowClosed(WindowEvent e) {

    }

    @Override
    public void windowIconified(WindowEvent e) {

    }

    @Override
    public void windowDeiconified(WindowEvent e) {

    }

    @Override
    public void windowActivated(WindowEvent e) {

    }

    @Override
    public void windowDeactivated(WindowEvent e) {

    }
}

class Listener2 extends WindowAdapter{
    @Override
    public void windowClosing(WindowEvent e) {
        System.exit(1);
    }
}